package activities;


import org.junit.runners.model.InitializationError;

import roboguice.RoboGuice;
import roboguice.activity.RoboActivity;
import android.app.Application;
import android.content.Context;

import com.google.inject.Injector;
import com.xtremelabs.robolectric.RobolectricTestRunner;

public class InjectedTestRunner extends RobolectricTestRunner {

	private Injector injector; 
	
	@Override 
	protected Application createApplication() {
		Application application = super.createApplication();
		return application;
	}

	public InjectedTestRunner(Class<?> testClass) throws InitializationError, InitializationError {
		super(testClass);
	}

	@Override 
	public void prepareTest(Object test) {
		Context context = new RoboActivity();
	    this.injector = RoboGuice.getInjector(context);
		this.injector.injectMembers(test);
	}
}
